<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateAdrewardDetailsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('adreward_details', function (Blueprint $table) {
            $table->id();
            $table->bigInteger('user_id')->unsigned()->index();
            $table->bigInteger('adreward_id')->unsigned()->index();
            $table->integer("amount");
            $table->integer('adtype_id')->unsigned()->index();
            $table->string('adtype_name');
            $table->integer('admodel_id')->unsigned()->index();
            $table->string('admodel_value');
            $table->decimal('reward_rate')->default(0);
            $table->integer('exchange_rate');
            $table->decimal('real_money');
            $table->decimal('user_money');
            $table->timestamp('displayed_at')->nullable();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('adreward_details');
    }
}
